<template>
	<view class="container">
		<view class="order-header" ref="orderHeader">
			<view class="order-user">
				<view class="">下单人</view>
				<view class="user-info">
					<image src="@/static/logo.png" mode="aspectFill" class="user-image"></image>
					<view class="user-name">张三</view>
				</view>
			</view>

			<view class="order-info">
				<view class="table-code">桌号：EA888</view>
				<view class="order-code">订单号:DG5645655</view>
			</view>
		</view>

		<view class="scroll-view-container">
			<!-- 左侧滑动区 -->
			<scroll-view class="left-scroll-view" scroll-y="true" :style="{height:wh + 'px'}">
				<block v-for="(item,i) in 20" :key="i">
					<view :class="['left-scroll-view-item', i === active ? 'active':'']" @click="activeChange(i)">选项
						{{i}}
					</view>
				</block>


			</scroll-view>
			<!-- 右侧滑动区 -->
			<scroll-view scroll-y="true" :style="{height:wh + 'px',backgroundColor:'#fff'}" :scroll-top="scorllTop">
				<view class="shop-content">
					<view class="shop-item" v-for="(item,i) in 5" :key="i">
						<image src="@/static/icons/shop-image.png" class="goods-image" mode="scaleToFill"></image>
						<view class="goods-intro">
							<view class="goods-name">冰激凌</view>
							<view class="goods-guige">1个</view>
						</view>
						<view class="goods-num">
							<uni-number-box :value="0" background="#73f201" color="#000" />
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
		<view class="fixed-area">
			<view class="order-area">
				<uni-icons type="bars" size="30"></uni-icons>
				<text>订单</text>
			</view>
			<view class="order-area">
				<text>￥56</text>
				<view class="pay-right-now-btn">立即支付</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		onLoad() {
			const orderHeader = this.$refs.orderHeader;
			const {
				height
			} = orderHeader.getBoundingClientRect();
			console.log('order-header height:', height);
		},
		methods: {

		}
	}
</script>

<style lang="scss">
	.order-header {
		margin-top: 10px;
		background-color: #fff;
		padding: 10px;
		display: flex;
		flex-direction: row;
		justify-content: space-between;

		.order-user {
			display: flex;
			flex-direction: column;

			.user-info {
				margin-top: 5px;
				display: flex;
				flex-direction: row;
				align-items: center;

				.user-name {
					margin-left: 5px;
					font-weight: bold;
				}
			}

		}

		.order-info {
			display: flex;
			flex-direction: column;
			justify-content: flex-end;
		}

	}

	.user-image {
		width: 50px;
		height: 50px;
	}

	.scroll-view-container {
		display: flex;

		.left-scroll-view {
			width: 120px;

			.left-scroll-view-item {
				background-color: #f7f7f7;
				line-height: 60px;
				text-align: center;
				font-size: 12px;

				&.active {
					background-color: #ffffff;
					position: relative;

					&::before {
						content: ' ';
						display: block;
						width: 3px;
						height: 30px;
						background-color: #73f201;
						position: absolute;
						top: 50%;
						left: 0;
						transform: translateY(-50%);
					}
				}
			}
		}
	}

	.shop-content {
		.shop-item {
			padding: 10px;
			display: flex;
			flex-direction: row;
			margin-bottom: 10px;

			.goods-image {
				width: 70px;
				height: 70px;
			}

			.goods-intro {
				margin-left: 5px;
				flex: 1;
				display: flex;
				flex-direction: column;

				.goods-name {
					font-size: 14px;
					font-weight: bold;
				}

				.goods-guige {
					font-size: 12px;
					color: #a5a099;
				}

			}

			.goods-num {
				display: flex;
				flex-direction: column;
				justify-content: flex-end;
				align-items: flex-end;
			}
		}


	}

	.fixed-area {
		position: fixed;
		bottom: 0;
		width: 100%;
		height: 50px;
		background-color: #fff;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		z-index: 999;

		.order-area {
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-left: 20px;
			font-size: 16px;
			color: #333;

			.pay-right-now-btn {
				background-color: #73f201;
				padding: 5px 20px;
				border-radius: 5px;
				margin: 0 10px;
			}

		}

	}
</style>